/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.acionista.entity;

import br.jm.acionista.filter.ConfiguraCampoAnnotation;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "codigo_ddd", catalog = "acionista", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "CodigoDdd.findAll", query = "SELECT c FROM CodigoDdd c")})
public class CodigoDdd implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_ddd", nullable = false)
    private Integer idDdd;
    @Column(name = "codigo", length = 20)
    private String codigo;
    @Column(name = "localidade", length = 50)
    private String localidade;
    @Column(name = "municipio", length = 50)
    private String municipio;
    @Basic(optional = false)
    @Column(name = "sigla", nullable = false, length = 20)
    private String sigla;
    @JoinColumn(name = "cod_uf", referencedColumnName = "cod_uf", nullable = false)
    @ManyToOne(optional = false)
    @ConfiguraCampoAnnotation(tipo = "String", pesquisa = "codUf.codUf", campo = "cod_uf", nomeTabela = "codigo_ddd", nomeTabelJoin = "cep_uf")
    private CepUf codUf;

    public CodigoDdd() {
    }

    public CodigoDdd(Integer idDdd) {
        this.idDdd = idDdd;
    }

    public CodigoDdd(Integer idDdd, String sigla, CepUf codUf) {
        this.idDdd = idDdd;
        this.sigla = sigla;
        this.codUf = codUf;
    }

    public Integer getIdDdd() {
        return idDdd;
    }

    public void setIdDdd(Integer idDdd) {
        this.idDdd = idDdd;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getLocalidade() {
        return localidade;
    }

    public void setLocalidade(String localidade) {
        this.localidade = localidade;
    }

    public String getMunicipio() {
        return municipio;
    }

    public void setMunicipio(String municipio) {
        this.municipio = municipio;
    }

    public String getSigla() {
        return sigla;
    }

    public void setSigla(String sigla) {
        this.sigla = sigla;
    }

    public CepUf getCodUf() {
        return codUf;
    }

    public void setCodUf(CepUf codUf) {
        this.codUf = codUf;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDdd != null ? idDdd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CodigoDdd)) {
            return false;
        }
        CodigoDdd other = (CodigoDdd) object;
        if ((this.idDdd == null && other.idDdd != null) || (this.idDdd != null && !this.idDdd.equals(other.idDdd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.acionista.entity.CodigoDdd[ idDdd=" + idDdd + " ]";
    }

    
    
}
